<template>
  <div>
    <h3>欢迎您</h3>
    <van-collapse v-model="activeNames" style="width:200px" v-for="i in zylist" :key="i.id">
        <van-collapse-item  :title="i.name" >
          <p v-for="j in i['son']" :key="j">
            <router-link v-if="i.id==j.pid" name="1" :to="{path:j['url']}">{{j.name}}</router-link>
            <router-link v-else to=""></router-link>
          </p>
        </van-collapse-item>
    </van-collapse>
    <van-button to="zlogin" text="去登录"/>
  </div>
</template>

<script>
import maxios from "@/http/axios";

export default {
  name: "indexzhu",
  data() {
    return {
      activeNames: ['1'],
      zylist: [],
      userid: localStorage.getItem('userid')
    }
  },
  methods: {
    get_res() {
      maxios('/book/get_zy?userid=' + this.userid, 'get').then(res => {
        this.zylist = res.list
      })
    },
    gogo(url) {
      alert(url)
    }
  }, mounted() {
    this.get_res()
  }
}
</script>

<style scoped>

</style>